package com.hnkywl.sts.dao.base;

import com.hnkywl.sts.entity.base.Fj;
import net.ruixin.orm.hibernate.SimpleHibernateTemplate;
import org.hibernate.Criteria;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

/**
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-4-3
 * Time: 下午6:45
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class FjDao extends SimpleHibernateTemplate<Fj,Long> {
     public Fj getFjLj(Long id){
         Criteria critera=this.getSession().createCriteria(entityClass)
         .setProjection(Projections.projectionList()
                 .add(Property.forName("wjlj").as("wjlj"))
                 .add(Property.forName("deleted").as("deleted"))
                 .add(Property.forName("lastUpdated").as("lastUpdated"))
         ).add(Restrictions.eq("id", id)).setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
         return (Fj)critera.uniqueResult();
     }
}
